const mongoose = require('mongoose');
const login=async ({username,password})=>{
    const usersModel=mongoose.model('users');
    return await usersModel.find({username,password});
}
const reg =async({ username, password }) => {
    const usersModel = mongoose.model('users');
    let result=await usersModel.find({username});
    if(result.length!=0){
        return result;
    }else{
    // 新增用户信息
    return  await  usersModel.create({ username, password });
    }
};
module.exports = { reg ,login };
